<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
</head>
<body class="gray-bg">
	
	<div class="ibox-content">
	<!-- 搜索框部分start -->
			<form class="form-inline" id="serchform">
		    <div class="form-group mr-20">
				<label for="name">导师名称</label>
				<input name="name" type="text" class="form-control" id="name">
			</div>
			<button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search " ></i> 搜索</button>
			<button  type="reset" class="btn btn-info btn-sm"><i class="fa fa-refresh " ></i> 重置</button>
		</form>
		
	<!-- 搜索框部分en -->
	
		<table id="mgrid" >
			<thead>
				<tr>
					<th data-radio="true"  ></th>
					<th data-field="name">导师姓名</th>
				</tr>
			</thead>
		</table>
		
		<div class="row" >
				<button class="btn btn-primary center-block" onclick="bindTutor()" >确认绑定</button>
		</div>
		
	</div>
	
	<script type="text/javascript">
	var myGrid;
		$(function(){
			//初始化表格
			 myGrid=MGrid.initGrid({
				 url:"${path}/admin/showMentor",
			 });
		});
		
	
		
		function bindTutor(){
			var arr=myGrid.initParam.$table.bootstrapTable('getSelections');
			var mentorId = arr[0].id;
			$.AjaxProxy({
				a : false,
				c : false,
				p : {mentorId:mentorId}
			}).invoke("${path}/admin/newAssessment/binding", function(loj) {
				console.log(loj.getValue("info"));
				if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						parent.location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
			});
		}
		
	</script>
</body>
</html>
